<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
%>
<jsp:include page="/comm/header.jsp"></jsp:include>
<script src="<%= path%>/script/jquery-1.4.2.min.js" ></script>
<div class="clear"></div>
<!--第1部分开始  --> 
    <div class="wrap1">
    	<div class="blank1"></div>
<!--选项卡开始--> 	
<div id="mainTabbox">
 		<jsp:include page="../tabboxhead.jsp"/>
 	<div id="conten">
 		<div class="tab_show" id="con_tabmy_1">
  
<jsp:include page="left.jsp"></jsp:include>
<div class="wrap_left">
	<div class="wrap_m2">
    	<!--密码管理开始-->
<form name="modifyPass" action="<%=path%>/user/modifypass.htm" method="post">
<div class="outbox4">
	<div class="tab7_tt">修改密码</div>
	<div><s:property value="tipMessage" /></div>
	<div class="input_box">
		<ul>
    	<li class="t1"><span class="span33">当前密码：</span></li>
        <li class="t2"><s:password name="userModel.password" id="password" styleClass="input1"/><div id="passwd_msg"></div></li>
        <li class="t1"><span class="span33">设置新密码：</span></li>
        <li class="t2"><s:password name="userModel.newpassword" id="newpassword" styleClass="input1"/><div id="new_msg"></div></li>
        <li class="t1"><span class="span33">确认新密码：</span></li>
        <li class="t2"><s:password name="userModel.newpassword2" id="newpassword2" styleClass="input1"/><div id="new2_msg"></div></li>
    	</ul>
	</div>
	<div class="clear"></div>
	<div class="but_submit" style="text-align:center; margin:30px 0"><a href="#" onclick="changePasswd();">确认修改</a>&nbsp;&nbsp;&nbsp;</div>
	<div class="tips1"><span><b>安全提醒：</b>请妥善保管密码！代购岛工作人员不会以任何理由向您索取密码。</span></div>
</div>
<!--密码管理结束-->
</form>
    </div>
</div>
<div class="clear"></div>
        <!--内容结束-->
 		</div>
 	</div>
 </div>
<!--选项卡结束-->         
      </div>
    </div>
<jsp:include page="/comm/bottom.jsp"></jsp:include>
</body>
</html>
<script type="text/javascript">
    var  msgDisplay = ""; 
	function changePasswd(){
		//清空操作
		$("#passwd_msg").html("");
		$("#new_msg").html("");
		$("#new2_msg").html("");
		
		msgDisplay = "passwd_msg";
		var oldpasswd=$("#password").val().replace(/(^\s*)|(\s*$)/g, "");
		//原密码不能为空
   		if(oldpasswd=='')
		{
   			$("#"+msgDisplay).html("当前密码不能为空!");
   			return;
		}
		
   		var newpasswd = $("#newpassword").val().replace(/(^\s*)|(\s*$)/g, "");
   		var newpasswd2 = $("#newpassword2").val().replace(/(^\s*)|(\s*$)/g, "");
   		
   		msgDisplay = "new_msg";
   		if(newpasswd==''){
   			$("#"+msgDisplay).html("新密码不能为空!");
   			return;
   		}
   		
   		//新密码必须为6到20位的字母和数字
   		if(newpasswd.length<6||newpasswd.length>20)
   		{
   			$("#"+msgDisplay).html("新密码必须为6到20位的字母和数字!");
   			return;
   		}
   		var Regx = /^[A-Za-z0-9]*$/;
		//必须为字母和数字
		if(!Regx.test(newpasswd))
		{
			$("#"+msgDisplay).html("新密码必须为6到20位的字母和数字!");
   			return;
		}
   		
		msgDisplay = "new2_msg";
   		if(newpasswd2!=newpasswd){
   			$("#"+msgDisplay).html("密码与确认密码不一致!");
   			return;
   		}
		document.modifyPass.submit();
	}
</script>
